package utils;

public class SpongeCube {
	protected double x,y,z; 
	protected double side;
	public SpongeCube(double x, double y, double z, double side) {
		super();
		this.x = x;
		this.y = y;
		this.z = z;
		this.side = side;
	}
	public double getSide() {
		return side;
	}
	public void setSide(double side) {
		this.side = side;
	}
	public double getX() {
		return x;
	}
	public void setX(double x) {
		this.x = x;
	}
	public double getY() {
		return y;
	}
	public void setY(double y) {
		this.y = y;
	}
	public double getZ() {
		return z;
	}
	public void setZ(double z) {
		this.z = z;
	}
	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(side);
		result = PRIME * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(x);
		result = PRIME * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(y);
		result = PRIME * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(z);
		result = PRIME * result + (int) (temp ^ (temp >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final SpongeCube other = (SpongeCube) obj;
		if (Double.doubleToLongBits(side) != Double.doubleToLongBits(other.side))
			return false;
		if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
			return false;
		if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
			return false;
		if (Double.doubleToLongBits(z) != Double.doubleToLongBits(other.z))
			return false;
		return true;
	} 
	public String toString(){
		double sidex=side+0.0001; 
		String s="box {<"+(x-sidex/2)+","+(y+sidex/2)+","+(z+sidex/2)+">,";
		s+="<"+(x+sidex/2)+","+(y-sidex/2)+","+(z-sidex/2)+">"; 
		s+="texture{Texture0}}"; 
		return s; 
	}
	public String sphere() {
		String s="sphere{<"+x+","+y+","+z+">,"+(side*0.5)+" pigment{color White transmit 0.99} finish {reflection 0.01 specular 0.1} interior{ior 1.33}  }";
		return s;
	}
	
}
